<?php
/*由bean脚本生成 powerBy--joe*/
namespace app\common\validate;

use app\common\bean\OrderTotalBean;

class OrderTotalValidate extends BaseValidate
{

	static $all = 'all';
	static $add = 'add';
	static $edit = 'edit';
	static $pkId = 'id';

	public function __construct(array $rules = [], array $message = [], array $field = [])
	{
		parent::__construct($rules, $message, $field);
		$this->rule = [
			 OrderTotalBean::$id => 'require', //
			 OrderTotalBean::$orderNumber => 'require|max:255', //订单号
			 OrderTotalBean::$userId => 'require', //用户id
			 OrderTotalBean::$type => 'require', //类型（1充值、2消费）
			 OrderTotalBean::$transactionPrice => 'require', //交易金额
			 OrderTotalBean::$otherPrice => 'require', //其他金额（充值为赠送金额，消费为折扣金额）
			 OrderTotalBean::$realPrice => 'require', //实际交易金额
			 OrderTotalBean::$payType => 'require', //1微信支付，2余额支付
			 OrderTotalBean::$blance => 'require|max:255', //用户余额
			 OrderTotalBean::$createdAt => 'require', //创建时间
		];
		$this->message = [
			OrderTotalBean::$id.POINST."require " => 'id必须', //
			OrderTotalBean::$orderNumber.POINST."require " => 'order_number必须', //订单号
			OrderTotalBean::$userId.POINST."require " => 'user_id必须', //用户id
			OrderTotalBean::$type.POINST."require " => 'type必须', //类型（1充值、2消费）
			OrderTotalBean::$transactionPrice.POINST."require " => 'transaction_price必须', //交易金额
			OrderTotalBean::$otherPrice.POINST."require " => 'other_price必须', //其他金额（充值为赠送金额，消费为折扣金额）
			OrderTotalBean::$realPrice.POINST."require " => 'real_price必须', //实际交易金额
			OrderTotalBean::$payType.POINST."require " => 'pay_type必须', //1微信支付，2余额支付
			OrderTotalBean::$blance.POINST."require " => 'blance必须', //用户余额
			OrderTotalBean::$createdAt.POINST."require " => 'created_at必须', //创建时间
		];
		$this->scene = [
			self::$all => [
				OrderTotalBean::$id,
				OrderTotalBean::$orderNumber,
				OrderTotalBean::$userId,
				OrderTotalBean::$type,
				OrderTotalBean::$transactionPrice,
				OrderTotalBean::$otherPrice,
				OrderTotalBean::$realPrice,
				OrderTotalBean::$payType,
				OrderTotalBean::$blance,
				OrderTotalBean::$createdAt,
			],
			self::$add => [
				OrderTotalBean::$orderNumber,
				OrderTotalBean::$userId,
				OrderTotalBean::$type,
				OrderTotalBean::$payType,
				OrderTotalBean::$blance,
			],
			self::$edit => [
				OrderTotalBean::$id,
				OrderTotalBean::$orderNumber,
				OrderTotalBean::$userId,
				OrderTotalBean::$type,
				OrderTotalBean::$payType,
				OrderTotalBean::$blance,
			],
			self::$pkId => [],

		];
	}


}
